﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using AttributeRouting;
using AttributeRouting.Web.Mvc;
using Phatent.Model.Pages;
using Phatent.Logic.Pages;
namespace Phatent.Website.Areas.Admin.Controllers
{
    [RouteArea("Admin")]
    [RoutePrefix("Page")]
    [Authorize]
    public class PageController : Controller
    {
        [Route("")]
        public ActionResult Index()
        {
            return View();
        }

        [Route("Edit/{id:int?}")]
        public ActionResult Edit(int id=0)
        {
            PageModel model;
            if (id > 0)
                model = PageLogic.GetPage(id);
            else
                model = new PageModel() { PageType=1 };
            return PartialView(model);
        }

        [Route("EditContent/{id:int}")]
        public ActionResult EditContent(int id)
        {
            var model = PageLogic.GetPage(id);
            return PartialView(model);
        }

        [Route("WaitVisible")]
        public ActionResult WaitVisible()
        {
            return View();
        }
    }
}
